package freespiritsocial.io.user.viewmodel.delegates

import freespiritsocial.io.user.event.EventViewModel
import freespiritsocial.io.user.network.apiService
import me.hgj.jetpackmvvm.base.BaseApp
import me.hgj.jetpackmvvm.base.appContext
import me.hgj.jetpackmvvm.ext.request

class PeopleDelegate: IPeopleApi {

    private val eventViewModel by lazy {
        (appContext as BaseApp).getAppViewModelProvider().get(EventViewModel::class.java)
    }

    override fun attention(id: String?,isFollow: Boolean) {
        //	1：关注，2：不关注
        val status = if (isFollow) 2 else 1
        eventViewModel.request({
            apiService.attention(id,status)
        },{
            eventViewModel.attentionEvent.value = id
        },isShowDialog = true)
    }
}